package com.dpiinc.TechPage.model.jbean;

import com.beiji.lib.pen.model.PenDot;
import com.beiji.lib.pen.model.PenStroke;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by hu489_000 on 2018-08-07.
 *   当前页笔划类
 */

public class StrokeList implements Serializable {
    private ArrayList<PenStroke> strokes;

    public ArrayList<PenStroke> getStrokes() {
        return strokes;
    }

    public String getPointStr() {
        StringBuffer sb = new StringBuffer();
        for (int k = 0; k < strokes.size(); k++) {
            PenStroke s = strokes.get(k);
            if (s != null) {
                List<PenDot> pointList = s.getList();
                for (int i = 0; i < pointList.size(); i++) {
                    sb.append((pointList.get(i).getX()) * 100).append(" ").append((pointList.get(i).getY()) * 100).append(",");
                }
                if (sb.length() > 0) {
                    sb.deleteCharAt(sb.length() - 1);
                    sb.append(";");
                }
            }
        }
        if (sb.length() > 0) {
            sb.deleteCharAt(sb.length() - 1);
        }
        return sb.toString();
    }


    public void setStrokes(ArrayList<PenStroke> strokes) {
        this.strokes = strokes;

    }
}
